<!--
 * @Author: your name
 * @Date: 2022-04-06 23:21:11
 * @LastEditTime: 2022-04-07 00:05:04
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \算法测试\day0906\4.6.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p id="help">Helpful notes will appear here</p>
    <p>E-mail: <input type="text" id="email" name="email"></p>
    <p>Name: <input type="text" id="name" name="name"></p>
    <p>Age: <input type="text" id="age" name="age"></p>

    <script>
        function showHelp(help) {
            document.getElementById('help').innerHTML = help;
        }
        function setupHelp() {
            var helpText = [
                { 'id': 'email', 'help': 'Your e-mail address' },
                { 'id': 'name', 'help': 'Your full name' },
                { 'id': 'age', 'help': 'Your age (you must be over 16)' }
            ];

            for (var i = 0; i < helpText.length; i++) {
                var item = helpText[i];
                document.getElementById(item.id).onfocus = function () {
                    showHelp(item.help);
                }
            }
        }

        setupHelp();


        function MyObject(name, message) {
            this.name = name.toString();
            this.message = message.toString();
            this.getName = function () {
                return this.name;
            };

            this.getMessage = function () {
                return this.message;
            };
        }
        let a =new MyObject('123','666');
        let b =new MyObject('456','999');
        console.log(a.getName());
        console.log(b.getName());
    </script>
</body>

</html>